import { Fragment } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtActivityIndicator } from 'taro-ui'

import { NoData } from '../noData'

export const ListLoading = ({isDone, data}) => {
  return (
    <Fragment>
      { 
        !isDone
        ?
        <AtActivityIndicator content="加载中..."></AtActivityIndicator>
        :
        Array.isArray(data)
        ?
        data.length
        ?
        <View style={{
          padding: '10px 0',
          color: '#999',
          fontSize: '14px',
          textAlign: 'center'
        }}>-- 我也是有底线的 --</View>
        :
        <NoData/>
        :
        null
      }
    </Fragment>
  )
}

ListLoading.defaultProps = {
  isDone: false,
  data: []
}